home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
EXT
/
A-E
/
ByeBye.cpt
/
Byebye.Asm
next >
Wrap
Assembly Source File
|
1988-03-03
|
4KB
|
130 lines
;
; Bye-bye (shutdown) sound effect INIT
;
; © 1988 By Jim Nitchals, Compuserve ID 71001,2232.
;
; Comments or mail can also be left via the ECHOMAC BBS network.
;
; Call (415) 855-9548 by modem if you don't know a local number.
;
; This program is being distributed as shareware. Send whatever
; you think this program is worth to your favorite local BBS operator.
; He/she could probably use the money.
;
; This program may NOT be sold, or included as part of any for-sale
; package (including but not limited to bundled public domain packages.)
;
;
; Forgive some of the nonMDS-compatible syntax. I use my own assembler,
; not MDS or MPW. You'll have to rewrite or remove parts of this mess
; if you want to use this actual code. Sorry.
;
; The source code is provided for informational purposes only.
; Any modifications are the sole responsibility of the programmer
; changing the code. Any shutdown sound utility based on this code
; MUST include my name in the credits.
;
; This program is provided on an as-is basis, without any guarantee
; as to function or reliability.
;
;
; I'd like to apologize for the sound data sitting around in memory
; all the time, wasting valuable system heap. But it's only 14K.
;
68000 ; directives for my assembler
ORG 0 ; set relative origin to 0
EMUL8 ; yet another stupid directive
Stringform 3 ; equivalent to MDS "String_Format 3"
;
; System equates (equivalent to the MDS equates, more-or-less)
include Batcave:Xasm:JMacro.Asm
include Batcave:Xasm:JSysequ
include Batcave:Xasm:Traps
; ***********************************************************************
; This is the code which is executed during boot-up. It allocates
; system heap memory sufficient for the shutdown procedure, and
; copies itself there.
Start:
; don't install self if the mouse button is being held down.
tst.b MBstate
beq @abort
movem.l d0-d7/a0-a6,-(sp)
; allocate memory:
move.l #InitEND,d0
_NewPtrSys ; _NewPtr ,Sys
tst.w d0
bmi.s @error
move.l a0,a2 ; the pointer to the destination
lea Start(pc),a1 ; pointer to the start
move #InitEND-1,d0
@copy move.b (a1)+,(a0)+ ; klutzy block move
dbra d0,@copy
pea MyShutProc(a2) ;
move #1,-(SP) ; flag: before power off only
_ShutdwnInstall ; MPW: Move #3,-(sp); _Shutdown
@error:
movem.l (sp)+,d0-d7/a0-a6
@abort rts
;
; ***********************************************************************
; My shutdown procedure. Gets called only when a "Shut down" command
; is executed, and power is about to go off.
MyShutProc:
; this shut-down procedure uses the OLD Sound driver. This should
; in theory make it compatible with more Macintosh models.
movem.l d0-d7/a0-a6,-(sp)
lea ioRec(pc),a0
move #-4,ioRefnum(a0)
lea Synthrec(pc),a1
move.l a1,ioBuffer(a0)
move.l #SynthSize,ioReqCount(a0)
_Write
; delay for 1/3 second. I could be polling the ioResult of the record
; but am too lazy. This delay may need adjusting based on
move.l Ticks,d0
add.l #20,d0
@wait cmp.l Ticks,d0
bcc.s @wait
movem.l (sp)+,d0-d7/a0-a6
rts
ioRec dcb.b ioQElSize,0
dc.b 'Byebye init resource © 1988 by James Nitchals.'
dc.w 0 ; word-align the object code
;
; The sound synthesizer record:
Synthrec:
dc.w 0 ; mode=ffMode
dc.w 1,$6000 ; skip-sample amount (integer, fraction)
;
; Waveform data is loaded as in-line code from a Soundcap data file.
; Be SURE your waveform data file isn't over 32,000 bytes
; in order to avoid the 32K resource size limit.
; the BLOAD command in my assembler loads raw data from the data fork of
; a file.
WaveStart:
BLOAD Batcave:Nifty:ByeBye
SynthSize equ *-WaveStart
InitEND equ *-Start
;
; a resource called "sysz" must be created: a long-word telling
; the INIT package how much system heap we want. If you don't include
; this resource, sounds larger than 13K or so can't be loaded.
syszData:
dc.l syszEND-Start
syszEND equ *
;
;
; ***********************************************************************
; Save the INIT and sysz resources.
; You'd probably set up an MDS Link file
; to convert the above code into the correct resource types.
; TYPE ID OFFSET LENGTH OUTPUT FILE
;
rsave 'INIT', 1,Start, InitEND-Start, Batcave:ByebyeINIT
rsave 'sysz', 0,syszData, syszEND-syszData, Batcave:ByebyeINIT
end